<?php

class Jquery extends CI_Controller {
	
	public function Jquery() {
		parent::__construct();
	}
	
	function index() {
		$this->load->view('jquery_view');
	}
	public function username_taken()
	{
		//$this->load->model('ProfileModel', '', TRUE);
		$username = trim($_POST['username']);
		// if the username exists return a 1 indicating true
		echo 1;
	}
	
	public function calculate_discount()
	{
		//calculate disocunted price and return
		$price = trim($_POST['price']);
		$percentage = trim($_POST['percentage']);
		
		echo $price - (((int)$price * (int)$percentage) / 100);
	}
}
